<%@ page contentType='text/html; charset=iso-8859-1' language="java" errorPage="../interface/erro.jsp" %>
<%@ page pageEncoding="UTF-8"%>
<%@ include file="../WEB-INF/jspf/setMeta.jspf" %>
<%@ include file="../WEB-INF/jspf/varGlobal.jspf" %>
<%@ include file="../WEB-INF/jspf/acesso.jspf" %>

<sql:query var='rsetUsuario' dataSource='${con}'>    
    SELECT Usuario.usuario, Usuario.nome, Usuario.equipe FROM Usuario 
    WHERE Usuario.usuario = '<%out.print( session.getValue("usuarioLogado"));%>'        
</sql:query>

    <jsp:useBean id="bnProjeto" class="controller.SGCA.Usuario">
        <c:set target='${bnProjeto}' property='url' value='${urlString}' />
        <c:set target='${bnProjeto}' property='drv' value='${conDriver}' />
        <c:set target='${bnProjeto}' property='idUsuario' value='${param.idUsuario}' />
        <c:set target='${bnProjeto}' property='nome' value='${param.nome}' />
        <c:set target='${bnProjeto}' property='usuario' value='${param.usuario}' />
        <c:set target='${bnProjeto}' property='perfil' value='${param.perfil}' />
        <c:set target='${bnProjeto}' property='equipe' value='${param.equipe}' />
        <c:set target='${bnProjeto}' property='statusUsuario' value='Ativo' />
        <c:set target='${bnProjeto}' property='senha' value='${param.senha}'  />
        <c:set target='${bnProjeto}' property='dataSenha' value='0000-00-00' />
    </jsp:useBean>
    
    <c:set var='retorno' value='${bnProjeto.alterar}' />
    <%@ include file='../WEB-INF/jspf/anoteDados.jspf' %>
    
    <script language="javascript">
    <c:if test='${retorno < 1}'>
        alert('Problemas para editar este Registro, verifique os dados.');
    </c:if>   
        
    </script> 
  
  <html> 
      <head></head>
      <body onload="javascript:monta();">
          
          <form name="form1" method="post" action="../controller/registrarLog.jsp">
            
          <input type="hidden" name="idLogSGCA" value="" />
          <input type="hidden" name="usuario" value="" />
          <input type="hidden" name="idSolicitacao" value="" />
          <input type="hidden" name="equipe" value="" />
          <input type="hidden" name="cliente" value="" />
          <input type="hidden" name="dataLog" value="" />
          <input type="hidden" name="horaLog" value="" />
          <input type="hidden" name="acao" value="" />
          <input type="hidden" name="nomeComputador" value="" />
          <input type="hidden" name="ipComputador" value="" />
          <input type="hidden" name="proxPagina" value="../interface/visualizarUsuariosDoSistema.jsp" />
          <input type="hidden" name="mensagem" value="Dados do usuário ${param.nome} editados com sucesso!" />
          
    <script language="javascript" type="text/javascript">
      
      function monta(){       
     
              document.form1.usuario.value = "<c:out value="${rsetUsuario.rowsByIndex[0][1]}"/>";
              document.form1.idSolicitacao.value = "<c:out value="${rsetUsuario.rowsByIndex[0][1]}"/>";
              document.form1.equipe.value = "<c:out value=""/>";
              document.form1.cliente.value = "<c:out value="CEPROMAT"/>";
              document.form1.dataLog.value = "<c:out value=""/>";
              document.form1.horaLog.value = "<c:out value=""/>";
              document.form1.acao.value = "Editou dados do usuário ${param.nome}";
              document.form1.nomeComputador.value = "<c:out value=""/>";
              document.form1.ipComputador.value = "<c:out value=""/>";
              document.form1.submit();
      }
      
      </script>
      </body>
  </html> 
    